import React, {Component} from 'react';
import {StoreContext} from "../hoc/storeContext";
import connect from "../hoc/connect";
import {changeUsernameAction} from "../store/todo/actionCreator";

class Hello extends Component {
    render() {
        return (
            <div>
                123
                {/*{this.context.getState().todo.username}*/}
            </div>
        );
    }
}

const mapStateToProps = (state)=>({
    username:state.todo.username
})

const mapDispatchToProps = (dispatch)=>({
    changeUsername(name){
        dispatch(changeUsernameAction(name))
    }
})
// Hello.contextType = StoreContext

export default connect(mapStateToProps,mapDispatchToProps)(Hello);
